package com.lz.code.consumer.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.lz.code.api.HelloService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liuzhi
 * @Description
 * @Date 2022/3/3 14:42
 */
@RestController
@Slf4j
public class HelloController {

    @Reference(timeout = 3000, loadbalance = "roundrobin", check = false)
    private HelloService helloService;

    @GetMapping("/hello")
    public String hello (@RequestParam(name = "name") String name) {
        log.info(String.format("dubbo-consumer execute. [%s]",name));
        return helloService.sayHello(name);
    }


}
